package com.example.dahua.templateMethod;

/**
 * @author: dangwen
 * @createDate: 2021/7/3
 * 带有钩子的模板方法模式
 */
public abstract class TravelTemplate {

    void toTravel(){
        byCar();
        byPlane();
        byBoat();
        if(tooFar()){
            byTrain();
        }
    }

    public abstract void byCar();
    public abstract void byPlane();
    public abstract void byBoat();
    public abstract void byTrain();
    public abstract boolean tooFar();

}
